home *** CD-ROM | disk | FTP | other *** search
-
- /*
- There may be additional include files required depending
- upon the compile product you are using. Typical compilers
- include Microsoft C by Microsoft or Turbo C by Boland Int'l.
- */
- #include <stdio.h>
- struct names{
- char *person;
- int number;
- };
- main()
- {
- static struct names class[] = {
- "Rick", 1,
- "John", 2,
- "Jim", 3,
- "Gary", 4,
- "", 0
- };
- parray(class);
- }
- parray(list)
- struct names list[];
- {
- int i, j;
- /* print out names as strings */
- for(i=0; list[i].person[0] != '\0'; i++){
- printf("Name:%s",list[i].person);
- printf("Number:%d",list[i].number);
- }
- /* print out EACH character of the name */
- for(i=0, j=0; list[i].person[j] != '\0'; j=0, i++){
- while(list[i].person[j] != '\0'){
- printf("%c",list[i].person[j]);
- j++;
- }
- printf("\n");
- }
-
- }
-